using System.Collections.Generic;
using OracleInternal.SqlAndPlsqlParser.LocalParsing;

namespace OracleInternal.SqlAndPlsqlParser.RuleProcessors.ODPCommands
{
	internal static class OracleMbEarleyColumnRuleMultiProcessors
	{
		public static OracleMbEarleyRuleMultiProcessorAddItem[] s_vRuleProcessorItems;

		static OracleMbEarleyColumnRuleMultiProcessors()
		{
			OracleMbEarleyRuleMultiProcessorAddItem[] array = new OracleMbEarleyRuleMultiProcessorAddItem[4];
			OracleMbEarleyRuleMultiProcessorAddItem oracleMbEarleyRuleMultiProcessorAddItem = new OracleMbEarleyRuleMultiProcessorAddItem
			{
				m_vHeadSymbol = "column",
				m_vRHSSymbols = new string[1]
				{
					"identifier"
				},
				m_vRuleProcessor = Process_Column_Identifier_Rule,
				m_vAddType = OracleMbEarleyRuleMultiProcessorAddType.SpecificRule
			};
			array[0] = oracleMbEarleyRuleMultiProcessorAddItem;
			oracleMbEarleyRuleMultiProcessorAddItem = new OracleMbEarleyRuleMultiProcessorAddItem
			{
				m_vHeadSymbol = "column",
				m_vRHSSymbols = new string[2]
				{
					"column",
					"identifier"
				},
				m_vRuleProcessor = Process_Column_Column_Identifier_Rule,
				m_vAddType = OracleMbEarleyRuleMultiProcessorAddType.SpecificRule
			};
			array[1] = oracleMbEarleyRuleMultiProcessorAddItem;
			oracleMbEarleyRuleMultiProcessorAddItem = new OracleMbEarleyRuleMultiProcessorAddItem
			{
				m_vHeadSymbol = "column",
				m_vRHSSymbols = new string[2]
				{
					"identifier",
					"'.'"
				},
				m_vRuleProcessor = Process_Column_Identifier_DOT_Rule,
				m_vAddType = OracleMbEarleyRuleMultiProcessorAddType.SpecificRule
			};
			array[2] = oracleMbEarleyRuleMultiProcessorAddItem;
			oracleMbEarleyRuleMultiProcessorAddItem = new OracleMbEarleyRuleMultiProcessorAddItem
			{
				m_vHeadSymbol = "column",
				m_vRHSSymbols = new string[4]
				{
					"identifier",
					"'.'",
					"identifier",
					"'.'"
				},
				m_vRuleProcessor = Process_Column_Identifier_DOT_Identifier_DOT_Rule,
				m_vAddType = OracleMbEarleyRuleMultiProcessorAddType.SpecificRule
			};
			array[3] = oracleMbEarleyRuleMultiProcessorAddItem;
			s_vRuleProcessorItems = array;
		}

		public static object Process_Column_Identifier_Rule(OracleMbEarleyParserMultiContext ctx, int ruleMatchPosition)
		{
			OracleLpColumn oracleLpColumn = new OracleLpColumn(((OracleLpParserContext)ctx).CurrentStatement);
			ctx.SetActiveObject(10, oracleLpColumn);
			oracleLpColumn.Name = new OracleLpName(ctx.Tokens[ctx.CurrentParseNode.From].m_vContent);
			return oracleLpColumn;
		}

		public static object Process_Column_Column_Identifier_Rule(OracleMbEarleyParserMultiContext ctx, int ruleMatchPosition)
		{
			List<ParseNode> list = ctx.CurrentParseNode.Children();
			OracleLpColumn oracleLpColumn = new OracleLpColumn(((OracleLpParserContext)ctx).CurrentStatement);
			ctx.SetActiveObject(10, oracleLpColumn);
			OracleMbEarleyRuleMultiProcessor.ProcessNodeRules(list[0], 0, -1, ctx);
			oracleLpColumn.Name = new OracleLpName(ctx.Tokens[list[1].From].m_vContent);
			return oracleLpColumn;
		}

		public static object Process_Column_Identifier_DOT_Rule(OracleMbEarleyParserMultiContext ctx, int ruleMatchPosition)
		{
			List<ParseNode> list = ctx.CurrentParseNode.Children();
			((OracleLpColumn)ctx.GetActiveObject(10)).ParentObjectName = new OracleLpName(ctx.Tokens[list[0].From].m_vContent);
			return null;
		}

		public static object Process_Column_Identifier_DOT_Identifier_DOT_Rule(OracleMbEarleyParserMultiContext ctx, int ruleMatchPosition)
		{
			List<ParseNode> list = ctx.CurrentParseNode.Children();
			OracleLpColumn obj = (OracleLpColumn)ctx.GetActiveObject(10);
			obj.ParentObjectName = new OracleLpName(ctx.Tokens[list[2].From].m_vContent);
			obj.SchemaName = new OracleLpName(ctx.Tokens[list[0].From].m_vContent);
			return null;
		}
	}
}
